package com.dolawing.phonecallapp.listenphonecall;

import android.content.Context;

public class PhoneCallSettings {
    private static PhoneCallSettings instance = null;
    /**
     * 挂断状态值  true表示接通中，false表示未接通
     */
    private boolean hasOffHook = false;
    /**
     * 手机没有通话，在一般的状态值
     */
    public static final int CALL_TYPE_IDEL = 0;
    /**
     * 手机通话状态值
     */
    public static final int CALL_TYPE_CALLING = 1;
    /**
     * 手机响铃状态值
     */
    public static final int CALL_TYPE_RING = 2;
    /**
     * 当前手机通话状态值
     */
    public static final int currentState = CALL_TYPE_IDEL ;
    /**
     * 手机原来的通话状态值
     */
    private int oldState = CALL_TYPE_IDEL ;

    //时间戳
    private Long inComingRingStartTimestamp = 0L;  //来电响铃开始时间
    private Long outComingRingStartTimestamp = 0L;;  //去电响铃开始时间
    private Long inoutComingRingStopTimestamp = 0L;; //来电去电响铃结束时间
    private Long holdOnStartTimestamp = 0L;; //接听电话开始时间
    private Long holdOffStopTimestamp = 0L;; //挂断电话结束时间

    public PhoneCallSettings(Context context){}
    public static PhoneCallSettings getInstance(Context context){
        if (instance == null){
            synchronized (PhoneCallSettings.class){
                if (instance == null){
                    instance = new PhoneCallSettings(context);
                }
            }
        }
        return instance;
    }

    public boolean isHasOffHook() {
        return hasOffHook;
    }

    public void setHasOffHook(boolean hasOffHook) {
        this.hasOffHook = hasOffHook;
    }

    public int getOldState() {
        return oldState;
    }

    public void setOldState(int oldState) {
        this.oldState = oldState;
    }

    public Long getInComingRingStartTimestamp() {
        return inComingRingStartTimestamp;
    }

    public void setInComingRingStartTimestamp(Long inComingRingStartTimestamp) {
        this.inComingRingStartTimestamp = inComingRingStartTimestamp;
    }

    public Long getOutComingRingStartTimestamp() {
        return outComingRingStartTimestamp;
    }

    public void setOutComingRingStartTimestamp(Long outComingRingStartTimestamp) {
        this.outComingRingStartTimestamp = outComingRingStartTimestamp;
    }

    public Long getInoutComingRingStopTimestamp() {
        return inoutComingRingStopTimestamp;
    }

    public void setInoutComingRingStopTimestamp(Long inoutComingRingStopTimestamp) {
        this.inoutComingRingStopTimestamp = inoutComingRingStopTimestamp;
    }

    public Long getHoldOnStartTimestamp() {
        return holdOnStartTimestamp;
    }

    public void setHoldOnStartTimestamp(Long holdOnStartTimestamp) {
        this.holdOnStartTimestamp = holdOnStartTimestamp;
    }

    public Long getHoldOffStopTimestamp() {
        return holdOffStopTimestamp;
    }

    public void setHoldOffStopTimestamp(Long holdOffStopTimestamp) {
        this.holdOffStopTimestamp = holdOffStopTimestamp;
    }
}
